/*
 * VectorBigramas.h
 *
 *  Created on: Dec 8, 2014
 *      Author: ale
 */
#include <fstream>
#include <stdlib.h>
#include <stdio.h>
#include <iostream>
#include <string>
#include <string.h>
#include <vector>
#include <cmath>
#include "VectorUnigramas.h"

#ifndef PRED_VECTORBIGRAMAS_H_
#define PRED_VECTORBIGRAMAS_H_

class VectorBigramas {
public:
	VectorBigramas(VectorUnigramas *unis);
	virtual ~VectorBigramas();

	VectorUnigramas *unigramas;

	size_t tam;

	vector<unsigned int> s_palabras;//vector<string> s_palabras;
	vector<unsigned int> hist;
	vector<float> probs;
	vector<float> boffs;
	vector<unsigned int> mejor_trigrama_que_lo_completa; //(solo la tercer palabra)

	vector<istream::streampos> offsets;

	unsigned int buscarBigrama(string A, string B,size_t,size_t);
	bool existeBigrama(string A, string B);
	unsigned int agregarBigrama(string A, string B, double prob, double boff);
	double obtenerProbabilidad(string A, string B);
	double obtenerBackOff(string A, string B);

	void imprimirBigramas();
	string contenidoComoString(unsigned int);

	void agregarOffsetDeABenTrigramas(string A, string B, istream::streampos offset);

	unsigned int obtenerHash(const char* unigrama, size_t len);

	void agregarOffsetDeAenBigramas(string A, istream::streampos offset);

	bool agregarMejorTrigramaQueCompleta(string A, string B, string tercer_palabra);
};

#endif /* PRED_VECTORBIGRAMAS_H_ */
